package org.luxor.html.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.luxor.html.service.TemplateService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;

/**
 * @author Mr.yan @date 2019/9/22
 */
@Slf4j
@Controller
@Api("默认页")
public class IndexController {
    @Resource
    private TemplateService templateService;

    @GetMapping(value = "/")
    public String home() {
        return index();
    }

    @GetMapping(value = "/index.html")
    @ApiOperation("首页")
    public String index() {
        log.info("Enter the index page");
        return templateService.getIndex();
    }

    @GetMapping(value = "/oss.html")
    @ApiOperation("上传页")
    public String oss() {
        log.info("Enter the oss page");
        return templateService.getThemeUri("oss");
    }

    @GetMapping(value = "/error")
    @ApiOperation("默认错误页")
    public String error() {
        return templateService.getError();
    }

    @GetMapping(value = "/403.html")
    @ApiOperation("403错误页")
    public String err403() {
        return templateService.get403();
    }

    @GetMapping(value = "/404.html")
    @ApiOperation("404错误页")
    public String err404() {
        return templateService.get404();
    }

    @GetMapping(value = "/500.html")
    @ApiOperation("500错误页")
    public String err500() {
        return templateService.get500();
    }

}
